#include "widget.h"
#include "ui_widget.h"

#include "mylabel.h"
#include <QtDebug>

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);

    auto* l = new MyLabel(this);
    l->setText("哈哈哈");
    l->resize(200, 200);
    l->move(20, 20);
    l->setFrameShape(QFrame::Box);

    this->setMouseTracking(true);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::mouseMoveEvent(QMouseEvent *event)
{
    ui->label->move(event->windowPos().x(), event->windowPos().y());
}
